<include file="Public:header" />
<script type="text/javascript">
function makeHTML_cofirm(){
	if(window.confirm("即将进行静态页面生成，请确认！")==true){
		return true;
	}
	else{
		return false;
	}
}

function chk(){
	//alert (document.getElementsByName("oper")[2].value);
	var arr_num = 0;
	var arr_row = document.getElementsByName("arr_row[]")
	
	//var k = 0;
	var arr_l = arr_row.length;	//news_row 长度
	
	for(k = 0; k < arr_l; k++){
		if(arr_row[k].checked == true){
			arr_num++;
		}
	}
	
	
	if(document.getElementsByName("oper")[0].checked == true ){
		alert ("请选择操作!");
		return false;
	}
	else if(document.getElementsByName("oper")[1].checked == true){
		//alert ("删除!");
		if(arr_num == "0"){
			alert("请选择分类!");
			return false;
		}
	}
	else if(document.getElementsByName("oper")[2].checked == true){
		
/*		alert (document.getElementById("c_id").value);
		alert (news_num);*/
		
		if(document.getElementById("id").value == "0" && arr_num == "0"){ //没有选择分类或者新闻;
			alert ("没有选择新闻或者分类，即将全部生成html！");
			
		}
		return makeHTML_cofirm();	//进行生成确认;
	}
	
}

function select_All(){
	var i=0;
	if(document.getElementById("all_arr").checked == true){
		//alert ("全选");
		var i=0;
		while(i < document.getElementsByName("arr_row[]").length){
			document.getElementsByName("arr_row[]")[i].checked = true;
			i++;
		}
	}
	else{
		while(i < document.getElementsByName("arr_row[]").length){
			document.getElementsByName("arr_row[]")[i].checked = false;
			i++;
		}
	}

}

function set_url(ob){
	var xform = document.getElementById("form1");
	//xform.action="index.asp"
	var op = ob.id;

	var url = "__APP__/Category/"+op;
	//alert (url);
	xform.action = url; 
}

function sub_query(sub){
	var c_id = sub.value;
	//alert(c_id);
	//alert ("/thinkincms/admin.php/news/index/cid/"+c_id);
	self.location = "/Rdcms/admin.php/news/index/cid/"+c_id;
}
</script>
<body>
<a href="__APP__/Category/category_add">增加产品分类</a>

<br><br>
<form id="form1" name="form1" onsubmit="return chk()" method="post" action="">
<input type="submit" name="arr_sub" id="arr_sub" value="提交">
<input type="radio" name="oper" id="none" value="arr" checked onclick="set_url(this)">不操作
<input type="radio" name="oper" id="category_del" value="{$current_p}" onclick="set_url(this)">删除
<input type="checkbox" name="all_arr" id="all_arr" value="all_arr" onclick="select_All()">全选


  <table   border="1" cellpadding="0" cellspacing="0">
    <tr>
	  <td><div align="center">选择</div></td>
      <td><div align="center">序号</div></td>
      
	  <td ><div align="center">分类名</div></td>	 
	  <td ><div align="center">操作</div></td>
    </tr>

<volist name="list" id="two" key="k">
	<tr>
	  <td><div align="center"><input type="checkbox" name="arr_row[]" id="arr_row[]" value="{$two.cid}"></div></td>
      <td><div align="center">{$k}</div></td>
	  
	  <td><div align="center">{$two.cname}</div></td>
      <td><div align="center"><a href="__APP__/category/category_edit/cid/{$two.cid}/nowp/{$current_p}">修改</a></div></td>
	  
    </tr>
    
</volist>
	
  </table>
</form>
<br>


<!--添加分页-->
{$page}
<br />
</body>
<include file="Public:footer" />
